package com.heima.bingfagongjulei;

import java.util.HashMap;
import java.util.concurrent.ConcurrentHashMap;

public class MyHasMap {
    public static void main(String[] args) throws InterruptedException {
        ConcurrentHashMap<String, String> con = new ConcurrentHashMap<>();
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 25; i++) {
                con.put(i + "", +i + "");
            }
        });
        Thread t2 = new Thread(() -> {
            for (int i = 25; i < 51; i++) {
                con.put(i + "", +i + "");
            }
        });
        t1.start();
        t2.start();
        System.out.println("==========");
        Thread.sleep(1000);
        for (int i = 0; i < 51; i++) {
            System.out.println(con.get(i + ""));
        }
    }
}
